<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        /*让容器的宽度高度都充满全屏*/
        html,
        body {
            width: 100%;
            height: 100%;
        }

        body {
            background-color: pink;
            display: flex;
            /*变为弹性盒子布局*/
            flex-direction: row;
            /*主轴方向为水平方向*/
            align-items: center;
            /*水平居中*/
            justify-content: center;
            /*垂直居中*/
        }

        .heart {
            width: 200px;
            height: 200px;
            background-color: red;
            position: relative;
            /*相对定位，子元素绝对定位时以此为参照*/
            transform: rotate(45deg);
            /*旋转45度*/
            animation: heardbit 1s alternate infinite;/*动画效果，1秒钟完成，alternate表示来回播放，infinite表示无限循环*/
            box-shadow: 0 0 30px red;
        }

        .heart::before {
            content: "";
            width: 200px;
            height: 100px;
            background-color: red;
            position: absolute;
            left: 0;
            top: -99px;
            border-radius: 100px 100px 0 0;
            /*上半部分圆角*/
            box-shadow: 0 0 30px red;
        }

        .heart::after {
            content: "";
            width: 100px;
            height: 200px;
            background-color: red;
            position: absolute;
            left: -99px;
            top: 0;
            border-radius: 100px 0 0 100px;
            /*左半部分圆角*/
            box-shadow: 0 0 30px red;
        }

        /*心形跳动动画*/
        @keyframes heardbit {
            0% {
                transform: rotate(45deg) scale(0.6);
                /*初始状态，缩小60%*/
            }
            100% {
                transform: rotate(45deg) scale(1.2);
                /*结束状态，放大120%*/
            }
        }
    </style>
</head>

<body>
    <div class="heart"></div>
</body>

</html>